package com.decapre.zufangwang.controller;

import com.decapre.zufangwang.entity.Region;
import com.decapre.zufangwang.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@Api(tags = "Regions")
@RequestMapping("/regions")
public class RegionHandler {

    private RegionService regionService;

    @Autowired
    public RegionHandler(RegionService regionService){
        this.regionService = regionService;
    }

    @GetMapping("")
    @ApiOperation("getAllRegions")
    public List<Region> getAllRegionsWithDistricts(){
        return regionService.getAllRegionsWithDistricts();
    }
}
